const koa = require("koa");
const app = new koa();
// 设置响应时间
const respDurationMiddleware = require("./middleware/res_duration");
app.use(respDurationMiddleware);
// 设置相应头
const respHeaderMiddleware = require("./middleware/res_header");
app.use(respHeaderMiddleware);
// 绑定第三层中间件:业务部分
const respDataMiddleware = require("./middleware/res_data");
app.use(respDataMiddleware);
// 设置跨域
const accessControl = require("./middleware/accessControl");
app.use(accessControl);
// 开启服务
app.listen(3000, (err, suc) => {
  if (!err) {
    console.log("服务器开启成功端口3000");
  }
});
